/**    
* @Title: GroupController.java  
* @Package com.kaver.sso.web.controller.rest   
* @author roc   
* @date Aug 6, 2021 4:24:49 PM  
* @version V1.0  
* @copyright kaver 
*/
package com.kaver.sso.web.controller.rest;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.kaver.sso.def.Result;
import com.kaver.sso.def.dto.GoupDto;
import com.kaver.sso.def.req.AddGroupReq;
import com.kaver.sso.def.req.DelGroupReq;
import com.kaver.sso.def.req.GroupListReq;
import com.kaver.sso.def.req.GroupPageListReq;
import com.kaver.sso.def.req.UpdateGroupReq;
import com.kaver.sso.def.resp.PageResp;
import com.kaver.sso.service.GroupService;

/**  
* @ClassName: GroupController  
* @Description: 权限组
* @author roc  
* @date Aug 6, 2021 4:24:49 PM  
*    
*/
@RestController
@RequestMapping("/api/group")
public class GroupController {
    @Autowired
    GroupService groupService;
    
    /**
     * 添加权限组
     */
    @PostMapping("/addGroup")
    public Result<Void> addGroup(@RequestBody AddGroupReq req) {
        groupService.addGroup(req);
        return Result.createSuccess();
    }
    /**
     * 更新权限组
     */
    @PostMapping("/updateGroup")
    public Result<Void> updateGroup(@RequestBody UpdateGroupReq req) {
        groupService.updateGroup(req);
        return Result.createSuccess();
    }
    /**
     * 删除权限组
     */
    @PostMapping("/delGroup")
    public Result<Void> delGroup(@RequestBody DelGroupReq req) {
        groupService.delGroup(req);
        return Result.createSuccess();
    }
    /**
     * 权限组分页列表
     */
    @PostMapping("/groupPageList")
    public Result<PageResp<GoupDto>> groupPageList(@RequestBody GroupPageListReq req) {
        return Result.createSuccess(groupService.groupPageList(req));
    }
    /**
     * 权限组列表
     */
    @PostMapping("/groupList")
    public Result<List<GoupDto>> groupList(@RequestBody GroupListReq req) {
        return Result.createSuccess(groupService.groupList(req));
    }
}
